import { requestApi } from '../util/network';
// 用户登录
export const login = (userName, password) =>
  requestApi('/Login/index', 'POST', {
    username: userName,
    password: password,
    client_type: 'wap',
  });

export const smsLogin = (param) => requestApi('/Connect/sms_login', 'POST', { ...param, client_type: 'wap' });
//用户微信登录（废弃）
export const wechatLogin = (ref, from, inviterId) =>
  requestApi('/Wxauto/login', 'GET', {
    ref: ref,
    from,
    inviter_id: inviterId,
  });

//三方登录绑定手机号
export const binduser = (user, code, third_id, client_type) =>
  requestApi('/Login/bindThirdUser', 'GET', {
    user,
    code,
    third_id,
    client_type,
  });

//用户获取微信登录跳转链接
// export const wechatJump =
//     (link) =>
//         requestApi(
//             '/Wxauto/getCodeLink',
//             'GET',
//             {
//                 link,
//             }
//         );

// 用户微信登录
// export const wechatLogin =
//     (code,from, inviterId) =>
//         requestApi(
//             '/Wxauto/autoLogin',
//             'GET',
//             {
//                 code,
//                 from,
//                 'inviter_id': inviterId
//             }
//         );

// 绑定
export const bind = (type, from, openid, unionid, nickname, headimgurl, user, email, password, password2, inviter_id) =>
  requestApi('/Login/bind', 'POST', {
    type: type,
    from: from,
    openid: openid,
    unionid: unionid,
    nickname: nickname,
    headimgurl: headimgurl,
    user: user,
    email: email,
    password: password,
    password2: password2,
    inviter_id: inviter_id,
    client_type: 'wap',
  });
